<?php
//queries for update, included with update file
//get most recent record for that character
$sqlCharHist = "SELECT char_history_id, char_id, datestamp, curdate(), 
last_login FROM char_history WHERE char_id = ? ORDER BY last_login DESC LIMIT 0 , 1";
$pdo->bound_query($sqlCharHist,array($char_id),'One');
$sqlCharHistResult = $pdo->result;

//create character history record
$sqlInsertCharHistory = "INSERT into char_history (char_id, last_login, points, guild, level, item_level, spec1, spec2,  datestamp, userstamp) 
VALUES (?,?,?,?,?,?,?,?, curdate(), 1)";

$sqlUpdateCharSum = "UPDATE char_summary SET race=?, class=?, faction=?, achievements_earned=?, thumbnail=?, active=1, datestamp = now() WHERE char_id=?";

$sqlSelectCharSum = "SELECT race, class, faction, achievements_earned, thumbnail FROM char_summary WHERE char_id=?";

//create character stats record
$sqlInsertCharStats = "INSERT into char_history_stats (char_history_id, health, mana, strength, agility, stamina, intellect, spirit, armor, power, crit_chance, datestamp) VALUES (?,?,?,?,?,?,?,?,?,?,?, (select now()) )";
			
//create record for item bonuses
$sqlInsertCharItems = "INSERT into char_history_item_stats (char_history_id, main_dps, off_dps, hitrating,  
 datestamp, userstamp) 
VALUES (?,?,?,?, (select now()), 1)";


?>